package com.one.common.manager.imagchoose;

import android.content.Context;
import android.net.Uri;
import android.widget.ImageView;

import com.imnjh.imagepicker.ImageLoader;
import com.one.common.manager.imageloader.ILoader;
import com.one.common.manager.imageloader.LoaderManager;


/**
 * Author：zhulunjun
 * Time：2017/10/9
 * description：选择图片，加载器
 */

public class ChooseGlideLoader implements ImageLoader {
    @Override
    public void bindImage(ImageView imageView, Uri uri, int width, int height) {
        LoaderManager.getLoader().loadUri(imageView,
                uri,
                new ILoader.Options(ILoader.Options.RES_NONE, ILoader.Options.RES_NONE, width, height));
    }

    @Override
    public void bindImage(ImageView imageView, Uri uri) {
        LoaderManager.getLoader().loadUri(imageView, uri, ILoader.Options.defaultOptions());
    }

    @Override
    public ImageView createImageView(Context context) {
        ImageView imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        return imageView;
    }

    @Override
    public ImageView createFakeImageView(Context context) {
        return new ImageView(context);
    }
}
